package com.lsa.letcode.the113.pathSumII;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;

import com.lsa.letcode.common.LetCodeTestBase;
import com.lsa.letcode.common.TreeNode;
import com.lsa.letcode.common.TreeUtils;

public class PathSumIITest extends LetCodeTestBase {
	@Test
	public void test() throws Exception {
		test("tree1.tgf", 22, Arrays.asList(Arrays.asList(5,4,11,2), Arrays.asList(5,8,4,5)));
	}
	
	private void test(String resName, int sum, List<List<Integer>> expected) throws IOException {
		Solution s = new Solution();
		TreeNode n = TreeUtils.fromTgf(this.getClass(), resName);
//		System.out.println(s.pathSum(n, sum));
		assertEquals(expected, s.pathSum(n, sum));
	}
}